import request from '@/utils/request'
import { praseStrEmpty } from "@/utils/master";

// 查询机构列表
export function listInstitution(query) {
  return request({
    url: '/project/institution/list',
    method: 'get',
    params: query
  })
}

// 查询机构列表 同一个项目下的标段
export function dropDownBidByProjectId(projectId) {
  return request({
    url: '/project/institution/dropDownBidByProjectId/' + projectId,
    method: 'get'
  })
}

// 查询机构用户 已分配和未分配
export function getInstitutionUserList(data) {
  return request({
    url: '/project/institution/getInstitutionUserList',
    method: 'post',
    params: data
  })
}

// 保存用户机构
export function saveInstitutionUser(data) {
  return request({
    url: '/project/institution/saveInstitutionUser',
    method: 'post',
    params: data
  })
}

// 查询机构详细
export function getInstitution(institutionId) {
  return request({
    url: '/project/institution/' + praseStrEmpty(institutionId),
    method: 'get'
  })
}

// 查询机构详细
export function getBrowse(institutionId) {
  return request({
    url: '/project/institution/browse/' + praseStrEmpty(institutionId),
    method: 'get'
  })
}

// 新增机构
export function addInstitution(data) {
  return request({
    url: '/project/institution',
    method: 'post',
    data: data
  })
}

// 修改机构
export function updateInstitution(data) {
  return request({
    url: '/project/institution',
    method: 'put',
    data: data
  })
}

// 删除机构
export function delInstitution(institutionId) {
  return request({
    url: '/project/institution/' + institutionId,
    method: 'delete'
  })
}

// 导出机构
export function exportInstitution(query) {
  return request({
    url: '/project/institution/export',
    method: 'get',
    params: query
  })
}

// 查询机构详情
export function getInstitutionDetail(institutionId) {
  return request({
    url: '/project/institution/getInstitutionDetail/' + praseStrEmpty(institutionId),
    method: 'get'
  })
}

// 修改机构详情
export function updateInstitutionDetail(data) {
  return request({
    url: '/project/institution/updateInstitutionDetail',
    method: 'put',
    data: data
  })
}
